<?php
/*
 *  view: promotions/promotions_home.php
 */
?>

<h1><?php echo lang('promotions'); ?></h1>

<form method="post" id="form-filter" name='form-promotions-filter' action="" >
    <fieldset class="ui-widget-content ui-corner-all field_filter">
        <legend class="ui-widget-content ui-corner-all"><?=lang('filter')?></legend>
        <div style='display: block; width: 100%; clear: both; height:30px;'>
          <label><?php echo lang('username');?>:</label>
          <label>ID:</label>
          <label><?php echo lang('gender');?>:</label>
          <label><?php echo lang('status');?>:</label>
          <label><?php echo lang('zip_code');?>:</label>
          <label><?php echo lang('age')." ".lang('from');?>:</label>
          <label><?php echo lang('age')." ".lang('to');?>:</label>
        </div>
        <input type="text" name="filter[username]" id="filter_username" placeholder="<?php echo lang('username');?>" class="text ui-widget-content ui-corner-all" />
        <input type="text" name="filter[id]" id="filter_id" placeholder="ID" class="text ui-widget-content ui-corner-all"/>
        <select name="filter[gender]" id="filter_gender" class="text ui-widget-content ui-corner-all">
                <option value=""><?php echo lang('gender');?></option>
                <option value="male"><?php echo lang('male');?></option>
                <option value="female"><?php echo lang('female');?></option>
         </select>
         <select name="filter[status]" id="filter_status" class="text ui-widget-content ui-corner-all">
                <option value=""><?php echo lang('status');?></option>
                <option value="1"><?php echo lang('normal');?></option>
                <option value="0"><?php echo lang('pending');?></option>
                <option value="-1"><?php echo lang('deleted');?></option>
        </select>  
        <input type="text" name="filter[zip_code]" id="filter_zip_code" placeholder="<?php echo lang('zip_code')?>" class="text ui-widget-content ui-corner-all"/>
        <input type="text" name="filter[age_from]" id="filter_age_from" placeholder="<?php echo lang('age')." ".lang('from')?>" class="text ui-widget-content ui-corner-all"/>
        <input type="text" name="filter[age_to]" id="filter_age_to" placeholder="<?php echo lang('age')." ".lang('to')?>" class="text ui-widget-content ui-corner-all"/>
        <br/>
        <div style='display: block; width: 100%; clear: both; height:28px;'>
          
         <label><?php echo lang('start_reg_date');?>:</label>
         <label><?php echo lang('end_reg_date');?>:</label>
         <label><?php echo lang('last_message');?>:</label>
         <label><?php echo lang('state');?>:</label>
         <label><?php echo lang('online');?>:</label>
         <label><?php echo lang('paying_client');?>:</label>
         <label><?php echo lang('have_image');?>:</label>
        </div>
        <input type="text" name="filter[start_reg_date]" id="filter_start_reg_date" placeholder="<?php echo lang('start_reg_date')?>" class="text date_picker ui-widget-content ui-corner-all"/>
        <input type="text" name="filter[end_reg_date]" id="filter_end_reg_date" placeholder="<?php echo lang('end_reg_date')?>" class="text date_picker ui-widget-content ui-corner-all"/>
        <input type="text" name="filter[last_message]" id="filter_last_message" placeholder="<?php echo lang('last_message')?>" class="text date_picker ui-widget-content ui-corner-all"/>
        <select name="filter[state]" id="filter_state" class="text ui-widget-content ui-corner-all">
            <option value="">---</option>
            <?php foreach ($states as $state) echo " <option value=".$state->name.">".lang($state->name)."</option>";?>
        </select>  
        <input type="checkbox" name="filter[online]" id="filter_online" class="text ui-widget-content ui-corner-all"/>
        <input type="checkbox" name="filter[paying_client]" id="filter_paying_client" class="text ui-widget-content ui-corner-all"/>
        
        <select name="filter[have_image]" id="filter_have_image" class="text ui-widget-content ui-corner-all">
          <option value=''></option>          
          <option value='1'><?php echo lang('yes'); ?></option>
          <option value='0'><?php echo lang('no'); ?></option>
        </select>
        <br/>
        
        <select name="filter[is_fake]" id="filter_is_fake" class="text ui-widget-content ui-corner-all">
                <option value=""><?php echo lang('is_fake');?></option>
                <option value="1"><?php echo lang('yes');?></option>
                <option value="0"><?php echo lang('no');?></option>               
        </select> 
        <br/>
        
        <input type="button" name="filter_submit" id="filter_submit" class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" value="<?php echo lang('search');?>" />
        <input type="reset" name="filter_reset" id="filter_reset" class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" value="<?php echo lang('reset');?>" />
   </fieldset>
</form><br/><br/>
<form method="post" id="form-select" name='form-promotions' action="" >
<input type="button" name="selected_submit" id="selected_submit" class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" style="width:200px;" value="<?php echo lang('send_promotion_code');?>" /> <br/>   
 <br/><br/>
 <div id="response"></div>
 <br/>
<table id="promotions_users" width='100%' class='table_pager' cellpadding=3px cellspacing=0>
  <thead>  
    <th><input type='checkbox' name='promotions_select_all' id='promotions_select_all' class='ui-widget-content ui-corner-all'/></th>
    <th>ID</th>
    <th><?=lang('username')?></th>
    <th>E-mail</th>
    <th><?=lang('registration_date')?></th>
    <th>IP</th>
    <th><?=lang('status')?></th>
    <th><?=lang('gender')?></th>
    <th><?=lang('look_for')?></th>
    <th><?=lang('birthdate')?> (<?=lang('age')?>)</th>
    <th><?=lang('state')?></th>
    <th><?=lang('zip_code')?></th>
    <th><?=lang('coins')?></th>
    <th><?=lang('bonus_coins')?></th>
    <th><?=lang('expenditure')?></th>
    <th><?=lang('last_message_date')?></th>   
    <th><?=lang('affiliate')?></th>
 </thead>
 
    <tbody>
    <?php 
      $this->load->view('promotions/users_list');
    ?>  
    </tbody>

</table>
</form>

<?php 
    $this->load->view('promotions/dialog_promotion_code');
?>

<div id="dialog-user" class="hide" title="<?php echo lang('term_user'); ?>">

</div>